//
//  MYTheme_DefultPlaceholder_SearchView.m
//  JQLive
//
//  Created by Bruce on 2020/1/13.
//  Copyright © 2020 JQLive. All rights reserved.
//

#import "MYTheme_DefultPlaceholder_SearchView.h"

@implementation MYTheme_DefultPlaceholder_SearchView

#pragma mark - Intial Methods
/**
 初始化数据
 */
- (void)initData
{
    
}

/**
 初始化试图
 */
- (void)initView
{
    //添加手势
    self.userInteractionEnabled = YES;
    UITapGestureRecognizer* recognizer;
    recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapFrom:)];
    recognizer.numberOfTapsRequired = 1; // 点击次数
    recognizer.numberOfTouchesRequired = 1;//手指个数
    [self addGestureRecognizer:recognizer];
    
    self.backgroundColor = UIColorMakeWithHex(@"#F6F8F9");
    
    [self addPlaceholderIcon];
    [self addPlaceholderLabel];
}

- (void)addPlaceholderIcon
{
    UIImage *image = UIImageMake(@"common_Search_Icon");
    UIImageView *imageView = [[UIImageView alloc] init];
    imageView.image = image;
    [self addSubview:imageView];
    self.placeholderIcon = imageView;
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(image.size);
        make.left.mas_equalTo(20);
        make.centerY.equalTo(self);
    }];
}

- (void)addPlaceholderLabel
{
    UILabel *label = [[UILabel alloc] init];
    label.text = @"搜索";
    label.textColor = MY_Text_Color_Theme3;
    label.font = [UIFont systemFontOfSize:14];
    label.numberOfLines = 1;
    [self addSubview:label];
    self.placeholderLabel = label;
     [label mas_makeConstraints:^(MASConstraintMaker *make) {
         make.centerY.equalTo(self);
         make.left.equalTo(self.placeholderIcon.mas_right).offset(10);
     }];
}

#pragma mark - Network Methods

#pragma mark - Target Methods

#pragma mark - Public Methods

#pragma mark - Private Methods
- (void)handleTapFrom:(UITapGestureRecognizer *)recognizer
{
//处理点击事件
    if (self.clickBlock) {
        self.clickBlock();
    }
}


#pragma mark - Lazy Loads
- (void)setViewRadius:(CGFloat)viewRadius
{
    _viewRadius = viewRadius;
    ViewRadius(self, viewRadius);
}
@end
